Inheritance diagram for TBitField:

Public Types | |
| typedef T | TMask |
| use this for declaring masks, enums may not work for 64-bit ints | |
| typedef T | bits |
Public Member Functions | |
| TBitField (void) | |
| TBitField (const T initialBits) | |
| T & | GetBits (void) |
| const T & | GetBits (void) const |
| boolean | TestMasked (const T mask) const |
| void | ClearMasked (const T mask) |
| void | SetMasked (const T mask) |
| void | ToggleMasked (const T mask) |
| void | SetMaskedValue (const T mask, const boolean value) |
| boolean | TestBit (const uint32 elemNum) const |
| void | ClearBit (const uint32 elemNum) |
| void | SetBit (const uint32 elemNum) |
| void | ToggleBit (const uint32 elemNum) |
| void | SetBitValue (const uint32 elemNum, const boolean value) |
| void | ClearAllBits (void) |
| void | SetAllBits (void) |
| void | ToggleAllBits (void) |
| void | SetAllBitValues (const boolean value) |
Static Public Member Functions | |
| static TBitField< T > & | CastFromWord (T &word) |
| static const TBitField< T > & | CastFromWord (const T &word) |
Note that the bits field is public so that shift operations and other built in compiler bit ops are possible.
What about multi-bit values, probably add new classes for this like TBitFieldN<T> and implement 2,3,4,... with just Test/SetBitValue ops. RotateLeft/Right and other non-standard bit operations would be nice too.
|
|
|
|
|
use this for declaring masks, enums may not work for 64-bit ints
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1.4.5